

		* APPENDIX 9: Over-time Analyses with all Survey-Takers 
		* PART 3: DESCRIPTIVE STATISTICS 
		

cd "$data"
use "data1.dta", clear 


forval i=6/7 {
gen independent`i' = .
}

forval i=6/7 {
	replace independent`i' = 1 if pid`i'==0
	replace independent`i' = 0 if pid`i'==5 | pid`i'==2 | pid`i'==1 | pid`i'==3 | pid`i'==4
} 


forval i=6/7 {
gen labour`i' = .
}

forval i=6/7 {
	replace labour`i' = 1 if pid`i'==2
	replace labour`i' = 0 if pid`i'==0 | pid`i'==1 | pid`i'==3 | pid`i'==4 | pid`i'==5
} 

forval i=6/7 {
gen conservative`i' = .
}

forval i=6/7 {
	replace conservative`i' = 1 if pid`i'==1
	replace conservative`i' = 0 if pid`i'==0 | pid`i'==2 | pid`i'==3 | pid`i'==4 | pid`i'==5
} 


forval i=6/7 {
gen libdem`i' = .
}

forval i=6/7 {
	replace libdem`i' = 1 if pid`i'==3
	replace libdem`i' = 0 if pid`i'==0 | pid`i'==2 | pid`i'==1 | pid`i'==4 | pid`i'==5
} 

forval i=6/7 {
gen UKIP`i' = .
}

forval i=6/7 {
	replace UKIP`i' = 1 if pid`i'==4
	replace UKIP`i' = 0 if pid`i'==0 | pid`i'==2 | pid`i'==1 | pid`i'==3 | pid`i'==5
} 


forval i=6/7 {
gen others`i' = .
}

forval i=6/7 {
	replace others`i' = 1 if pid`i'==5
	replace others`i' = 0 if pid`i'==0 | pid`i'==2 | pid`i'==1 | pid`i'==3 | pid`i'==4
} 


* TABLE 9.1: Descriptives (unlimited sample) 

cd "$tables"
eststo clear 
estpost sum education6 sex independent6 labour6 conservative6 libdem6 UKIP6 others6 leftRightW6 attention6
esttab using "$tables/Table9_1.tex", replace ///
	cells("count(fmt(a2)) mean sd min max") label ///
	title("Table of descriptives") nomtitle nonumber noobs
	
	
* TABLE 9.2: Descriptives (first 12 waves taken)	

eststo clear 
estpost sum education6 sex independent6 labour6 conservative6 libdem6 UKIP6 others6 leftRightW6 attention6 if waves_taken112==12
esttab using "$tables/Table9_2.tex", replace ///
	cells("count(fmt(a2)) mean sd min max") label ///
	title("Table of descriptives") nomtitle nonumber noobs	

	
	
* TABLE 9.2: Descriptives (first 20 waves taken)	

eststo clear 
estpost sum education6 sex independent6 labour6 conservative6 libdem6 UKIP6 others6 leftRightW6 attention6 if waves_taken120==20
esttab using "$tables/Table9_3.tex", replace ///
	cells("count(fmt(a2)) mean sd min max") label ///
	title("Table of descriptives") nomtitle nonumber noobs	
	
	
	